<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  </head>
  <body>
    <script>
      let p3 = $.ajax({ url: "./data/3.json" });

      let p2 = $.ajax({ url: "./data/2.json" });

      let p1 = $.ajax({ url: "./data/1.json" });

      let p4 = $.ajax({ url: "./data/4.json" });

// 只要第一个状态pending 状态变成  resolve 或者 reject  就返回结果
// 只跟let 有关  
      Promise.race([p1,p2,p3,p4]).then(res=>{
          console.log(res);
      })
    </script>
  </body>
</html>
